const { createPages } = require("./index.js");
const page = {
  root_dir: '../',
  page_dir: 'page',
  pages: [
    { path: 'index', title: '首页' },
    { path: 'about', title: '关于亿众' },
    { path: 'about-cause', title: '八大事业部' },
    { path: 'course', title: '企业历程' },
    { path: 'produced', title: '出品中心' },
    { path: 'news', title: '新闻资讯' },
    { path: 'news-page', title: '新闻资讯' },
     // { path: 'news-page', title: '条款和条件' },
    { path: 'contact', title: '联系我们' }
  ],
  widget:[
  //   {path:'header',name:'header'},
  //   {path:'footer',name:'footer'},
  //   {path:'swiper',name:'swiper'},
  //   {path:'focus-Page',name:'focusPage'},
  //   {path:'sidebar',name:'sidebar'},
  ]
}

createPages(page)
const { pages } = page
let _fn = (c, el) => {
  let name= el.path.split('/').pop();
  return [...c, { text: el.title, link:`${name}.html` }]
}
console.log(pages.reduce(_fn, []));